package com.fsxgt.datagrid.ds.tool;

import com.fsxgt.datagrid.ds.utils.JdbcConstants;


public class SqlToolFactory {

    //根据数据库类型返回对应的接口
    public static MetaSqlInterface getByDbType(String dbType) {
        if (JdbcConstants.MYSQL.equals(dbType)) {
            return MySQLSqlTool.getInstance();
        } else if (JdbcConstants.ORACLE.equals(dbType)) {
            return OracleSqlTool.getInstance();
        } else if (JdbcConstants.POSTGRESQL.equals(dbType)) {
            return PostgresqlSqlTool.getInstance();
        } else if (JdbcConstants.SQL_SERVER.equals(dbType)) {
            return SqlServerSqlTool.getInstance();
        } else if (JdbcConstants.HIVE.equals(dbType)) {
            return HiveSqlTool.getInstance();
        }else if(JdbcConstants.CLICKHOUSE.equals(dbType)) {
            return ClickHouseSqlTool.getInstance();
        } else if(JdbcConstants.HBASE20XSQL.equals(dbType)) {
            return Hbase20xsqlSqlTool.getInstance();
        } else if(JdbcConstants.MONGODB.equals(dbType)) {
            return null;
        }else {
            throw new UnsupportedOperationException("暂不支持的类型：".concat(dbType));
        }
    }
}
